﻿using System.Windows;
using MyFloridaHouse.ServiceConn.DistrBldrSvcRef;
using MyFloridaHouse.libSvUtilities.Logging;


namespace MyFloridaHouse.libSvMassDataReport.Reports
{
    public partial class ACSDistrictSummary
    {

        private void GetACSReportDefinition()
        {
            // load up the static data
            serviceDAL.GetACSReportDefinition(GetACSReportDefinitionCompleted);
        }

        public void GetACSReportDefinitionCompleted(object sender, GetACSReportDefinitionCompletedEventArgs args)
        {
            serviceDAL.getACSReportDefinitionRequestCount--;

            // error in WCF service call
            if (Log.HandleException(args.Error)) return;

            // unknown error in the service method
            if (args.Result == null)
            {
                MessageBox.Show("Error getting ACS District Summary Report Definition " + args.Error.Message.ToString());
            }
            else
            {
                // caught error in the service method
                if (Log.HandleServerError("GetACSReportDefinitionCompleted", args.Result.errorMessage)) return;

                // Everything OK!

                LoadACSDistrictSummaryReportDefintion(args.Result.definitionList);

            }
        }
    }
}
